#ifndef __PERSISTENCE_H__
#define __PERSISTENCE_H__
#include <sys/types.h>
#define STORE_PREFIX ".containers"

struct metadata {
    int conatiner_id; /// random number
    pid_t root_pid;   /// the first command's pid
    int cpu_share;    // cpu usage limit, default value 0, means  no limit
    int mem_limit;    // memory usage limit ,default value 0, means no limit
    int cpus;         //  max cpu numbers limit, default value 0,means no limit
};

/**
 * @brief: copy image from a tar.gz file into persistence store
 * @param: img_file     - a string of where the image stores
 * @param: container_id - create a corresponding dir in persistence store with
 *the this id
 **/
int copy_img(const char *img_file, const int container_id);

/**
 * @brief: store metadatas of meta_data.container_id
 **/
int store_metadata(const struct metadata meta_data);

/**
 * @brief: get metadatas of meta_data->container_id, which is stored in the
 *struct
 * @meta_data - currently including pid, cid
 **/
int load_metadata(struct metadata *meta_data);

/**
 * @brief: delete container persistence storage files
 * @param: container_id
 **/
int delete_container(const int container_id);

const char *get_store_path();

/**
 * @brief: get root path(where to chroot) of a container with its id
 **/
const char *get_root_path(const int container_id);

/**
 * @brief: get container.env file path with container id
 **/
const char *get_env_path(const int container_id);

#endif // !__PERSISTENCE_H__
